package co.yixiang.modules.shop.domain;

import lombok.Data;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import javax.persistence.*;
import javax.validation.constraints.*;
import java.math.BigDecimal;
import java.io.Serializable;

/**
* @author lijunze
* @date 2020-04-25
*/
@Entity
@Data
@Table(name="machine_show")
public class MachineShow implements Serializable {

    /** 机展中机械id */
    @Id
    @Column(name = "id")
    private Long id;

    /** 名称 */
    @Column(name = "name",nullable = false)
    @NotBlank
    private String name;

    /** 价格 */
    @Column(name = "price",nullable = false)
    @NotNull
    private BigDecimal price;

    /** 分类id */
    @Column(name = "type_id",nullable = false)
    @NotNull
    private Integer typeId;

    /** 分类名称 */
    @Column(name = "type_name",nullable = false)
    @NotBlank
    private String typeName;

    /** 轮播图 */
    @Column(name = "slider_image",nullable = false)
    @NotBlank
    private String sliderImage;

    /** 描述 */
    @Column(name = "store_info",nullable = false)
    @NotBlank
    private String storeInfo;

    /** 品牌id */
    @Column(name = "brand_id",nullable = false)
    @NotNull
    private Integer brandId;

    /** 品牌名称 */
    @Column(name = "brand_name",nullable = false)
    @NotBlank
    private String brandName;

    /** 重量 */
    @Column(name = "weight",nullable = false)
    @NotNull
    private BigDecimal weight;

    /** 高度 */
    @Column(name = "height",nullable = false)
    @NotNull
    private BigDecimal height;

    public void copy(MachineShow source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}